package com.zhoukx.composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName College
 * @Description:
 * @Author zhoukx
 * @Date 2020/8/10
 **/
public class College extends OrganizationComponet {
    //
    List<OrganizationComponet> organizationComponets = new ArrayList<>();

    public College(String name, String des) {
        super(name, des);
    }

    @Override
    protected void add(OrganizationComponet organizationComponet) {
        //  clolleage 的add 和
        organizationComponets.add(organizationComponet);
    }

    @Override
    protected void remove(OrganizationComponet organizationComponet) {
        organizationComponets.remove(organizationComponet);
    }

    /**
     *  输出 university 包含的学院
     */
    @Override
    protected void print() {
        System.out.println("-------------------"+getName()+"-----------");
        for (OrganizationComponet organizationComponet : organizationComponets) {
            organizationComponet.print();
        }
    }

    @Override
    public void setName(String name) {
        super.setName(name);
    }

    @Override
    public String getDes() {
        return super.getDes();
    }
}
